/**   
 * api接口统一管理
 */
import {
  get,
  post,

} from './http.js'


// 获取轮播图数据
export function getBanner(p) {
  return post('v2/banner/get', p);
}
export function getLocalBanner(p) {
  return post('/banner', p)
}
// 获取推荐歌单
export const getRecommend = p => post('personalized/playlist', p)
// 获取最新歌曲
export const getNewsong = p => post('personalized/newsong', p)

// 获取歌词
export const getMusicLyc = id => get(`/lyric?id=${id}`);
// 2020 5 20新接口
// 获取推荐电台
export const getPersonalizedRadio = p => post('/personalized/djprogram');
//获取歌手
export const getSinger = p => post('/artist/list', p)
//获取热门歌手
export const getHotSinger = p => post('/top/artists', p)
//获取歌手相关歌曲
export const getSingerMusic = id => get(`/artists?id=${id}`);
//获取相似歌手
export const getSimiSinger = id => get(`/simi/artist?id=${id}`);
//获取歌曲播放地址
export const getsongUrl = p => get(`/song/url`, p)
//检测歌曲是否可用
export const checkMusic = id => get(`/check/music?id=${id}`)

// 2020/6/3新增接口
// 获取歌单详情：
export const getSongSheet = id => post(`/playlist/detail?id=${id}`)
// 获取所有榜单
export const getRankingList = () => get(`/toplist`);
//获取榜单内容摘要
export const getRankDetail = () => get(`/toplist/detail`)
//获取热门搜索(多条)
export const getSearchHot = () => get(`/search/hot/detail`)
//获取搜索建议
/**
 * 必选参数: keywords: 关键词
 可选参数: limit: 返回数量, 默认为 30 offset: 偏移数量， 用于分页, 如: 如: (页数 - 1) * 30, 其中 30 为 limit 的值, 默认为 0
 type: 搜索类型； 默认为 1 即单曲, 取值意义: 1: 单曲, 10: 专辑, 100: 歌手, 1000: 歌单, 1002: 用户, 1004: MV, 1006: 歌词, 1009: 电台, 1014: 视频, 1018: 综合
 */
export const getSearchResult = (p) => get('/search', p);

// 2020/6/9新增评论api
// 获取歌单评论
export const getPlaylistComment = (id, p) => get(`/comment/playlist?id=${id}`, p)
// 获取最热评论：
export const getHotComment = (id, p) => get(`/comment/hot?id=${id}`, p)
// 获取歌曲评论：
export const getSongsComment = (id, p) => get(`/comment/music?id=${id}`, p)
//获取歌手描述
export const getSingerInfo = (id) => get(`/artist/desc?id=${id}`)

//2020/6/18新增 歌单分类api

// 获取歌单分类：
export const getCatList = () => get(`/playlist/catlist`);
//获取热门歌单分类：
export const getHotcatList = () => get(`/playlist/hot`);
//获取歌单
export const getSquareList = (p) => get(`/top/playlist`, p)
//获取精品歌单:
export const gethighquality = (p) => get(`/top/playlist/highquality`, p)

//手机登录
export const loginByPhone = (p) => post(`/login/cellphone?`, p)
// 发送手机验证码：
export const sendSms = (p) => post(`/captcha/sent?`, p)
//通过验证码登录
export const verifyPhoneCms = (p) => post(`/captcha/verify?`, p)
// 注册
export const register = (p) => post(`/register/cellphone?`, p)


// 登陆后接口：
// 1.获取用户详情
export const getUserDetail = (id) => get(`/user/detail?uid=${id}`)
// 2.登陆后获取用户信息，歌单，收藏：
export const getUserSubcount = () => get(`/user/subcount`)
// 3. 获取用户歌单
export const getUserSongSheet = (id) => get(`/user/playlist?uid=${id}`)

// 4.签到
export const signIn = () => get(`/daily_signin`)
// 5.获取私人FM
export const getPersonFM = () => get(`/personal_fm`)
// 6.获取个人推荐
export const getPersonRecommend = () => get(`/recommend/songs`)
// 7.喜欢音乐 p:{like:true,like:false}：
export const likeMusic = (id, p) => post(`/like?id=${id}`, p)
// 8-1新建歌单：
export const createSheet = (p) => post(`/playlist/create?`, p)
// 8-2删除歌单
export const deleteSheet = (p) => post(`/playlist/delete?`, p)
// 9.获取用户喜欢的音乐id列表：
export const getUserLikeList = () => get(`/likelist`)
// 10.更新用户信息：
export const updateUserInfo = (p) => post(`/user/update?`, p)

// 获取推荐mv
export const getRecommendMv = () => get(`/personalized/mv/`);
// 获取视频详情
export const getMvDetail = (id) => get(`/mv/detail?mvid=${id}`);
//获取mv点赞转发评论数据
export const getMvDetailInfo = (id) => get(`/mv/detail/info?mvid=${id}`)
// 获取mv播放地址
export const getMvSrc = (id) => get(`/mv/url?id=${id}`)
//获取当前mv相关视频
export const getRelatedMv = (id) => get(`/related/allvideo?id=${id}`)
//获取mv评论
export const getMvComment = (id) => get(`/comment/mv?id=${id}`);
// 发表评论
export const comment = (p) => post(`/comment?`, p)
